<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">

    <h:form id="TelevisoraListForm">

        <p:panel header="#{SeriesBundle.ListTelevisoraTitle}">
            <p:contextMenu id="TelevisoraDataTableContextMenu" for="datalist">  
                <p:menuitem value="#{SeriesBundle.Create}" onclick="document.getElementById('TelevisoraListForm:createButton').click();" icon="ui-icon-plus"/>
                <p:menuitem value="#{SeriesBundle.View}" onclick="document.getElementById('TelevisoraListForm:viewButton').click();" icon="ui-icon-search"/>
                <p:menuitem value="#{SeriesBundle.Edit}" onclick="document.getElementById('TelevisoraListForm:editButton').click();" icon="ui-icon-pencil"/>
                <p:menuitem value="#{SeriesBundle.Delete}" onclick="document.getElementById('TelevisoraListForm:deleteButton').click();" icon="ui-icon-trash"/>
                <p:separator/>
                <p:menuitem value="#{SeriesBundle.TelevisoraMenuItem_serieCollection}" icon="ui-icon-search"  action="#{televisoraController.navigateSerieCollection}" disabled="#{empty televisoraController.selected.serieCollection}" ajax="false"/>  
                <p:menuitem value="#{SeriesBundle.TelevisoraMenuItem_idImagen}" icon="ui-icon-search"  actionListener="#{televisoraController.prepareIdImagen}" update=":XImagenViewForm" oncomplete="PF('XImagenViewDialog').show()" disabled="#{empty televisoraController.selected.idImagen}"/>  
            </p:contextMenu>
            <p:dataTable id="datalist"
                         value="#{televisoraController.items}"
                         var="item"
                         rowKey="#{item.idTelevisora}"
                         paginator="true"
                         rows="25"
                         rowsPerPageTemplate="10,25,50,100"
                         selectionMode="single"
                         selection="#{televisoraController.selected}">

                <p:ajax event="rowSelect"   update=":TelevisoraListForm:createButton :TelevisoraListForm:viewButton :TelevisoraListForm:editButton :TelevisoraListForm:deleteButton :TelevisoraListForm:TelevisoraDataTableContextMenu" listener="#{televisoraController.resetParents}"/>
                <p:ajax event="rowUnselect" update=":TelevisoraListForm:createButton :TelevisoraListForm:viewButton :TelevisoraListForm:editButton :TelevisoraListForm:deleteButton :TelevisoraListForm:TelevisoraDataTableContextMenu" listener="#{televisoraController.resetParents}"/>
                <p:ajax event="rowDblselect" onsuccess="document.getElementById('TelevisoraListForm:viewButton').click();"/>

                <p:column sortBy="#{item.idTelevisora}" filterBy="#{item.idTelevisora}">
                    <f:facet name="header">
                        <h:outputText value="#{SeriesBundle.ListTelevisoraTitle_idTelevisora}"/>
                    </f:facet>
                    <h:outputText value="#{item.idTelevisora}"/>
                </p:column>


                <p:column sortBy="#{item.siglasTelevisora}" filterBy="#{item.siglasTelevisora}">
                    <f:facet name="header">
                        <h:outputText value="#{SeriesBundle.ListTelevisoraTitle_siglasTelevisora}"/>
                    </f:facet>
                    <h:outputText value="#{item.siglasTelevisora}"/>
                </p:column>


                <p:column sortBy="#{item.nombreTelevisora}" filterBy="#{item.nombreTelevisora}">
                    <f:facet name="header">
                        <h:outputText value="#{SeriesBundle.ListTelevisoraTitle_nombreTelevisora}"/>
                    </f:facet>
                    <h:outputText value="#{item.nombreTelevisora}"/>
                </p:column>


                <p:column sortBy="#{item.idImagen.descripcion}" filterBy="#{item.idImagen.descripcion}">
                    <f:facet name="header">
                        <h:outputText value="#{SeriesBundle.ListTelevisoraTitle_idImagen}"/>
                    </f:facet>
                    <h:outputText value="#{item.idImagen.descripcion}"/>
                </p:column>


            </p:dataTable>

            <p:commandButton id="createButton"                             icon="ui-icon-plus"   value="#{SeriesBundle.Create}" actionListener="#{televisoraController.prepareCreate}" update=":TelevisoraCreateForm" oncomplete="PF('TelevisoraCreateDialog').show()"/>
            <p:commandButton id="viewButton"   style="visibility: hidden;" icon="ui-icon-search" value="#{SeriesBundle.View}" update=":TelevisoraViewForm" oncomplete="PF('TelevisoraViewDialog').show()" disabled="#{empty televisoraController.selected}"/>
            <p:commandButton id="editButton"   style="visibility: hidden;" icon="ui-icon-pencil" value="#{SeriesBundle.Edit}" update=":TelevisoraEditForm" oncomplete="PF('TelevisoraEditDialog').show()" disabled="#{empty televisoraController.selected}"/>
            <p:commandButton id="deleteButton" style="visibility: hidden;" icon="ui-icon-trash"  value="#{SeriesBundle.Delete}" actionListener="#{televisoraController.delete}" update=":growl,datalist" disabled="#{empty televisoraController.selected}">
                <p:confirm header="#{SeriesBundle.ConfirmationHeader}" message="#{SeriesBundle.ConfirmDeleteMessage}" icon="ui-icon-alert"/>
            </p:commandButton>

        </p:panel>
        <ui:include src="/WEB-INF/generic/confirmation.xhtml"/>
    </h:form>

</ui:composition>